import React from 'react';
// 头部组件
import { SearchBar, Space } from 'antd-mobile'
import '@/assets/scss/header.scss';
import { useHistory } from 'react-router-dom'
const Header = () => {
    const style = {
        width: '100%',
        display: 'flex',
        alignItems: 'center',
        height: '54px',
        background: 'red'
    }
    const his = useHistory()
    return (
        <div style={style}>
            <span className='address'>地址</span>
            <SearchBar className='search' placeholder='请输入内容' />
            <span className='login' onClick={() => {
                if (localStorage.getItem('token')) {
                    // 
                    his.push('/mine')
                } else {
                    his.push('/login')
                }
            }}>{localStorage.getItem('token') ? '我的' : '登录'}</span>
        </div>
    );
}

export default Header;
